const Router = require('koa-router');
const {auth} = require('../middleware/auth.middleware');
const {menuValidator} = require('../middleware/menu.middleware')
const {addMenu, getMenus, updateMenu, deleteMenu} = require('../controller/menuController')

const menuRouter = new Router({prefix: '/menu'});

//添加菜单
menuRouter.post('/add', auth, menuValidator, addMenu)

//获取菜单
menuRouter.get('/get', auth, getMenus)

//修改菜单
menuRouter.put('/update/:id', auth, menuValidator, updateMenu)

//删除菜单
menuRouter.delete('/delete/:id', auth, deleteMenu)


module.exports = menuRouter;
